<script type="text/javascript" src="<?php echo base_url("public/js/comment.js"); ?>"></script>
<div class="col-md-2 col-xs-height navshadow">
    <ul class="nav nav-sidebar" >
        <div class="image">
            <img src="<?php echo base_url("public/images/sidebar_logo.jpg"); ?>" alt="logo_image" width="100%" height="150px" class="img-circle">
            <h3>Trung tâm</h3>
        </div>



        <?php
        foreach ($typeCenters as $value) {
            ?>
            <li class="<?php if ($idType == $value['id_type_center']) echo 'center-active' ?>"><a href="<?php echo base_url('index.php/website/article/type/' . $value['id_type_center']); ?>" ><?php echo $value['name_type']; ?></a>

                <?php
            }
            ?>

    </ul>
</div>
<div class="col-md-7 col-xs-height">   
    <div class="breadcrumbs" style="margin-top: 1%; margin-bottom: 1%;">
        <ul>
            <li><a href="<?php echo base_url("index.php/website/home"); ?>"><span class="glyphicon glyphicon-home"></span> Trang chủ</a></li>
            <li><a href="<?php echo base_url("index.php/website/article"); ?>"><span class="glyphicon glyphicon-file"></span> Tin Tức</a></li>
        </ul>
    </div>

    <div class="highlight">
        <div class="row">
            <h3><?php echo $article['title'] ?></h3>
            <p class="text-muted" style="font-size: 12px;">Ngày đăng: <?php echo date('H:i d/m/Y', strtotime($article['date'])); ?> Luot Xem: <?php echo $article['view'] ?></p>
            <hr>
        </div>
   
        <div class="row content">
            <p>
                <?php echo $article['source']; ?>
            </p>
            <div class="navbar-right">
                <h4><b><?php echo $article['first_name'] . ' ' . $article['last_name'] ?></b></h4>
            </div>
        </div>
    </div>
    <h3>
        <strong><em>Bình luận</em></strong>
    </h3>
    <!-- Nav tabs -->
    <ul class="nav nav-tabs" role="tablist">
        <li class="<?php echo (($activeTab1) ? 'active' : '') ?>"><a href="#facebook" role="tab" data-toggle="tab">Facebook</a></li>
        <li class="<?php echo (($activeTab1) ? '' : 'active') ?>"><a href="#website"  role="tab" data-toggle="tab">Website</a></li>
    </ul >

    <!-- Tab panes -->
    <div class="tab-content">
        <div class="tab-pane fade <?php echo (($activeTab1) ? ' in active' : '') ?>" id="facebook">
            <div id="fb-root"></div>
            <script>(function(d, s, id) {
                    var js, fjs = d.getElementsByTagName(s)[0];
                    if (d.getElementById(id))
                        return;
                    js = d.createElement(s);
                    js.id = id;
                    js.src = "//connect.facebook.net/vi_VN/sdk.js#xfbml=1&appId=1456817287931576&version=v2.0";
                    fjs.parentNode.insertBefore(js, fjs);
                }(document, 'script', 'facebook-jssdk'));</script>
            <div class="fb-comments" data-href="<?php echo base_url('index.php/website/article/id/' . $article['id_article']); ?>" data-numposts="5" data-colorscheme="light"></div>
        </div>
        <div class="tab-pane fade <?php echo (($activeTab1) ? '' : ' in active') ?>" id="website">
            <div>

                <div class="panel panel-info" style="padding: 10px;">
                    <?php
                    $this->load->library('session');
                    $sess = $this->session->userdata('logged_in');
                    if ($sess['sign_in'] == TRUE) :
                        $attr = array('class' => 'submitComment');
                        echo form_open('#', $attr);
                        ?>
                        <!-- Content 'comment' -->
                        <textarea 
                            style="background-color: #EEF9D9; resize: vertical;"
                            class="form-control" rows="3" id="comment_noidung" name="comment" 
                            placeholder="Trả lời tại đây ..."></textarea>
                        <br>
                        <p id="attention" class="text-danger" style="font-size:15px; display: none">Nội dung trả lời không được để trống.</p>
                        <!-- Content 'comment' -->
                        <input type="hidden" name="id_article" value="<?php echo $article['id_article']; ?>">
                        <div class="text-right">
                            <button type="submit" class="btn btn-primary">Bình luận</button>
                        </div>
                        <?php echo form_close(); ?>
                    <?php else : ?>
                        <div class="text-center">Đăng nhập để được tham gia bình luận.<br>
                            <?php echo form_open('/website/thanhvien/registration/load_login'); ?>
                            <button type="submit" name="submit" class="btn btn-primary" value="2">Đăng Nhập</button>
                            <?php echo form_close(); ?>
                        </div>
                    <?php endif; ?>
                </div>
                <div class="nav">
                    <div class="navbar-right" id="no-margin">
                        <?php echo $comment['link'] ?>
                    </div>
                </div>
                <div class="panel panel-info bg-mycolor" style="padding: 2px;">
                    <div id="insertAfterMe"></div>
                    <?php
                    if (!empty($comment['data'])) {
                        foreach ($comment['data'] as $row):
                            ?>
                            <div class="panel panel-default" style="padding: 5px; margin: 1px;">
                                <div class="panel-body" style="padding-top: 0px; padding-bottom: 0px; margin: 2px;">
                                    <div class="col-lg-1" style="padding-left: 0px;">
                                        <div class=" box-avatar">
                                            <a href="#" class="avatar" style="display: block;"><img src="<?php
                                                if (!file_exists($row['url_image'])) {
                                                    if ($row['id_sex'] == 1) {
                                                        $row['url_image'] = 'public/images/defaut_user/default-user.jpg';
                                                    } else {
                                                        $row['url_image'] = 'public/images/defaut_user/default-user-female.jpg';
                                                    }
                                                }
                                                echo base_url($row['url_image']);
                                                ?>" style=" width: 100%; height: 100%;">
                                            </a>
                                        </div>
                                    </div>
                                    <div class="col-lg-11">
                                        <strong><?php echo $row['first_name'] . ' ' . $row['last_name']; ?></strong><br>
                                        <p><?php echo $row['content'] . '.'; ?></p>
                                        <span class="text-muted" style=" font-size: 12px;">Vào lúc: <?php echo date('H:i d/m/Y', strtotime($row['date'])); ?></span>
                                    </div>
                                </div>
                            </div>
                            <?php
                        endforeach;
                    } else {
                        echo '<div id="suggest_comment" class="text-center"><em>Hãy tham gia trả lời nhé.</em></div>';
                    }
                    ?>
                </div>
                <div class="navbar-right">
                    <?php echo $comment['link'] ?>
                </div>

            </div>
        </div>

    </div>

</div>

<div class="col-md-3 col-xs-height">
   
    <div class="row">
        <div class="panel panel-warning">
            <!-- Default panel contents -->
            <div class="panel-heading">Các bài viết liên quan</div>
            <div class="panel-body">

                <?php foreach ($article_diff as $row): ?>
                <ul class="list-group">
                        <a class="list-group-item" href="<?php echo base_url('index.php/website/article/id/'.$row['id_article']);?>" target="blank">
                            <?php echo $row['title']?>
                        </a>
                </ul>
                <?php endforeach; ?>
             
            </div>
        </div>
    </div>
    
</div>
